#ifndef _SDLGLUTILS_H
#define _SDLGLUTILS_H

#include "SDL/SDL.h"
#include "SDL/SDL_image.h"
#include "SDL/SDL_ttf.h"
#include <GL/gl.h>
#include <GL/glu.h>

#include <cstring>
#include <cstdlib>


#ifndef GL_CLAMP_TO_EDGE
#define GL_CLAMP_TO_EDGE 0x812F
#endif

GLuint loadTexture(const char * filename,bool useMipMap = true);
int takeScreenshot(const char * filename);
void drawAxis(double scale = 1);
int initFullScreen(unsigned int * width = NULL,unsigned int * height = NULL);
int XPMFromImage(const char * imagefile, const char * XPMfile);
SDL_Cursor * cursorFromXPM(const char * xpm[]);
GLuint createTextureFromText(const char * text, GLuint texture, TTF_Font*,unsigned int * width,unsigned int * height);
void beginOrtho(int w,int h);
void endOrtho(int w,int h);
inline int next_p2 ( int a )
{
	int rval=1;
	while(rval<a) rval<<=1;
	return rval;
}
float racine(float);
float Q_rsqrt( float);

#endif //SDLGLUTILS_H
